import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    mode: "history", /*去除网址里的#号*/
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/pages/Home.vue'),
            meta: {title: '主页'},
            children: [
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/pages/Dashboard'),
                    meta: {title: '系统首页'}
                },
                {
                    path: '/contest',
                    component: () => import(/* webpackChunkName: "login" */ '../components/pages/Contest'),
                    meta: {title: '比赛'}
                },
                {
                    path: '/problemset',
                    component: () => import(/* webpackChunkName: "problemset" */ '../components/pages/Problemset'),
                    meta: {title: '题库'}
                },
                {
                    path: '/status',
                    component: () => import(/* webpackChunkName: "status" */ '../components/pages/Status'),
                    meta: {title: '评测记录'}
                },
                {
                    path: '/problem',
                    component: () => import(/* webpackChunkName: "message" */ '../components/pages/Problem'),
                    meta: {title: '题目详情'}
                },
                {
                    path: '/message',
                    component: () => import(/* webpackChunkName: "message" */ '../components/pages/Message'),
                    meta: {title: '消息通知'}
                },
                {
                    // 富文本编辑器组件
                    path: '/richtext',
                    component: () => import(/* webpackChunkName: "editor" */ '../components/pages/VueEditor.vue'),
                    meta: {title: '富文本编辑器'}
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: () => import(/* webpackChunkName: "markdown" */ '../components/pages/Markdown'),
                    meta: {title: 'markdown编辑器'}
                },
                {
                    // markdown组件
                    path: '/about',
                    component: () => import(/* webpackChunkName: "markdown" */ '../components/pages/About'),
                    meta: {title: '关于我们'}
                }
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/pages/Login'),
            meta: {title: '登录'}
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
